package com.adou.d9.api;

public class Test3 {
    public static void main(String[] args) {
        int[] arr = {11,22,33,44};
        getArrData(arr);
    }

    public static String getArrData(int[] arr){
        if(arr == null) {
            return null;
        }

        StringBuilder sb = new StringBuilder("[");
        for (int i = 0; i < arr.length; i++) {
            if(i == arr.length-1) {
                sb.append(arr[i]);
            } else {
                sb.append(arr[i]).append(',');
            }
        }
        sb.append("]");
        System.out.println(sb);
        return sb.toString();
    }
}
